package kr.moiba.commonCd.web;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import kr.moiba.commonCd.service.CommonCdSvc;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 이 영호(Youngho Lee)
 */

@Controller
@RequestMapping("/commonCd")
public class CommonCdCtrl {
	
	private final Logger logger = Logger.getLogger(getClass());
	
	@Autowired
	private MessageSourceAccessor messages;
	
	@Autowired
	private CommonCdSvc commonCdSvc;
		
	@RequestMapping(value={"/list.do"})
	public Map<String, Object> noticeList(HttpServletRequest request) throws Exception {
		Map<String, Object> condition = new HashMap<String, Object>();

		String title = ServletRequestUtils.getStringParameter(request, "title", "");
		condition.put("title", title);

		Map<String, Object> resultMap = new HashMap<String, Object>();
		resultMap.put("commonCdList", commonCdSvc.findbyListHeader(condition));

		return resultMap;
	}

}